package com.yidu.logisticssystem.service.impl;

import com.yidu.logisticssystem.entity.LogisticsUser;
import com.yidu.logisticssystem.dao.LogisticsUserDao;
import com.yidu.logisticssystem.service.LogisticsUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 用户表(LogisticsUser)表服务实现类
 *
 * @author makejava
 * @since 2021-03-09 16:21:11
 */
@Service("logisticsUserService")
public class LogisticsUserServiceImpl implements LogisticsUserService {
    @Resource
    private LogisticsUserDao logisticsUserDao;

    /**
     * 通过ID查询单条数据
     *
     * @param userId 主键
     * @return 实例对象
     */
    @Override
    public LogisticsUser queryById(Integer userId) {
        return this.logisticsUserDao.queryById(userId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<LogisticsUser> queryAllByLimit(int offset, int limit) {
        return this.logisticsUserDao.queryAllByLimit(offset, limit);
    }

    /**
     * 查询全部用户类
     * @param logisticsUser
     * @return
     */
    @Override
    public List<LogisticsUser> queryAll(LogisticsUser logisticsUser) {
        return this.logisticsUserDao.queryAll(logisticsUser);
    }

    /**
     * 新增数据
     *
     * @param logisticsUser 实例对象
     * @return 实例对象
     */
    @Override
    public int insert(LogisticsUser logisticsUser) {
       return this.logisticsUserDao.insert(logisticsUser);
    }

    /**
     * 新增数据
     *
     * @param logisticsUser 实例对象
     * @return 实例对象
     */
    @Override
    public int insertSelective(LogisticsUser logisticsUser) {
        return this.logisticsUserDao.insertSelective(logisticsUser);
    }

    /**
     * 修改数据
     *
     * @param logisticsUser 实例对象
     * @return 实例对象
     */
    @Override
    public int update(LogisticsUser logisticsUser) {
        return this.logisticsUserDao.update(logisticsUser);
    }

    /**
     * 修改数据
     *
     * @param logisticsUser 实例对象
     * @return 实例对象
     */
    @Override
    public int updateByPrimaryKeySelective(LogisticsUser logisticsUser) {
        return logisticsUserDao.updateByPrimaryKeySelective(logisticsUser);
    }

    /**
     * 通过主键批量删除
     * @param ids
     * @return
     */
    @Override
    public int deleteAll(String ids) {
        String [] id=ids.split(",");
        return this.logisticsUserDao.deleteAll(id);
    }

    /**
     * 通过主键删除数据
     *
     * @param userId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer userId) {

        return this.logisticsUserDao.deleteById(userId) > 0;
    }

    /**
     * 登录方法
     * @param logisticsUser
     * @return
     */
    @Override
    public LogisticsUser login(LogisticsUser logisticsUser) {
        return this.logisticsUserDao.login(logisticsUser);
    }

    @Override
    public LogisticsUser queryByUserName(LogisticsUser logisticsUser) {
        return this.logisticsUserDao.queryByUserName(logisticsUser);
    }
}
